package com.gexiaobao.pigeon.ui.adapter

import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.PassProjectInfo
import com.gexiaobao.pigeon.databinding.ItemAppPassProjectBinding

/**
 * @Author      : hxw
 * @Date        : 2024/7/23 9:27
 * @Describe    :
 */
class AdapterAppPassProject(data: ArrayList<PassProjectInfo>) :
    BaseQuickAdapter<PassProjectInfo, DataBindBaseViewHolder>(R.layout.item_app_pass_project, data) {
    override fun convert(holder: DataBindBaseViewHolder, item: PassProjectInfo) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemAppPassProjectBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        if (holder.layoutPosition % 2 == 0) {//偶数
            holder.setBackgroundColor(R.id.llItem, ContextCompat.getColor(context, R.color.comm_bg))
        } else {
            holder.setBackgroundColor(R.id.llItem, ContextCompat.getColor(context, R.color.white))
        }
    }
}